package com.cavy.platform.server.domain;

import lombok.Data;

@Data
public class PluginVolume extends AbstractRegexp {
    private String containerPath;
    private String hostPath;
    private String tips;
    private String label;

    /**
     * 1,containerPath路径一致
     * 2,hostPath符合正则
     */
    public ValidateError validate(ContainerVolumeData data) {
        if (!containerPath.equals(data.getContainerPath())) {
            return new ValidateError("容器挂载路径与插件不一致", data.getContainerPathFieldName());
        }
        boolean b = validateValue(data.getHostPath());
        if (!b) {
            return new ValidateError("主机路径有误", data.getHostPathFieldName());
        }
        return null;
    }
}
